<?php
/**
 * Nweb Editor
 *
 * This script is protected by copyright. Its use, copying, modification
 * and distribution without written consent of the author is prohibited.
 *
 * @category    source
 * @package     pl.nweb.editor.model
 * @subpackage  table
 * @author      Krzysztof Kardasz <krzysztof.kardasz@gmail.com>
 * @copyright   Copyright (c) 2012 Krzysztof Kardasz
 * @license     http://www.gnu.org/licenses/lgpl-3.0.txt  GNU Lesser General Public
 * @version     1.0 $Id$
 * @link        https://nweb-editor.googlecode.com
 * @link        http://editor.nweb.pl
 */

namespace pl\nweb\editor\app\model\gateway\table;

/**
 * Model tabeli
 *
 * @category    source
 * @package     pl.nweb.editor.model
 * @subpackage  table
 * @author      Krzysztof Kardasz <krzysztof.kardasz@gmail.com>
 * @copyright   Copyright (c) 2012 Krzysztof Kardasz
 * @version     1.0 $Id$
 */
class User extends \pl\nweb\editor\app\model\gateway\Table
{
    /**
     * Nazwa tabeli
     *
     * @var string
     */
    protected $_name = self::TABLE;

    /**
     * Klucz podstawowy
     *
     * @var string
     */
    protected $_primary = self::FIELD_ID;

    /**
     * Klasa wiersza tabeli
     *
     * @var string
     */
    protected $_rowClass = '\\pl\\nweb\\editor\\model\\gateway\\row\\User';

    /**
     * Role użytkowników
     *
     * @var array
     */
    protected static $_roles = array(
        self::ROLE_USER   => 'Użytkownik',
        self::ROLE_EDITOR => 'Edytor',
        self::ROLE_ADMIN  => 'Administrator'
    );

    /**
     * Nazwa tabeli
     */
    const TABLE = 'tbl_usr_user';

    /**
     * Pola tabeli
     */
    const FIELD_ID         = 'usr_id';
    const FIELD_EMAIL      = 'usr_email';
    const FIELD_PASS       = 'usr_pass';
    const FIELD_SALT       = 'usr_salt';
    const FIELD_ROLE       = 'usr_role';
    const FIELD_FIRST_NAME = 'usr_first_name';
    const FIELD_LAST_NAME  = 'usr_last_name';
    const FIELD_PHONE      = 'usr_phone';
    const FIELD_LOGIN_TIME = 'usr_login_time';
    const FIELD_CREATED    = 'usr_created';
    const FIELD_MODIFIED   = 'usr_modified';
    const FIELD_STATUS     = 'usr_status';

    /**
     * Status
     */
    const STATUS_ACTIVE     = 1;
    const STATUS_NOT_ACTIVE = 2;
    const STATUS_DISABLED   = 3;
    const STATUS_DELETED    = 9;

    /**
     * Role
     */
    const ROLE_USER   = 'user';
    const ROLE_EDITOR = 'editor';
    const ROLE_ADMIN  = 'admin';

    /**
     * Sól
     */
    const SALT = 'UX5ahJ2Deila3emoothu';
}